<?php

//防止恶意调用
if (!defined('IN_MOD'))
{
    die('Hacking attempt');
}

global $getmoduledata,$getmoduleother;

if($setblock == 'add')
{
	// 城市分站
	if($configinfo['cityok'] == 1)
	{
		$modulehook = "citytab";$hookblock = "admincityclass";require(MODULEPARA_PATH . 'config/modulehook.php');// 配置系统钩子
	}
	
	// 模块参数模板指定
	global $parameter;
	global $parameter_list;
	global $parameter_json;
	global $parameter_default;
	global $parameter_exp;
	global $parameter_expplist;
	global $parameter_exptable;
	global $parameter_attr;
	global $parameter_other;
	global $moduleparameter;

	// 获取模块参数HTML
	global $parameter_out,$getmoduleconfig;// 外部配置参数信息
	$contenthtml = configmoduleparameter();
	
	// 默认字段开启关闭配置
	$articledeffield = getdefaultarticlefield($configinfo['moduleid']);
	$defaultfield = $articledeffield['defaultfield'];
	$otherinfoconfig = $articledeffield['otherinfoconfig'];
	$toptype = $configinfo['moduleinfo']['index_num'];
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		$this->smarty_assign('defaultfield',  $defaultfield);
		$this->smarty_assign('otherinfoconfig',  $otherinfoconfig);
		$this->smarty_assign('toptype',  $toptype);
	}else{
		smarty_assign('defaultfield',  $defaultfield);
		smarty_assign('otherinfoconfig',  $otherinfoconfig);
		smarty_assign('toptype',  $toptype);
	}
	
	// 模块参数模板指定
	smarty_assign('parameter',     $parameter);
	smarty_assign('parameter_list',     $parameter_list);
	smarty_assign('parameter_json',     $parameter_json);
	smarty_assign('parameter_default',     $parameter_default);
	smarty_assign('parameter_exp',     $parameter_exp);
	smarty_assign('parameter_expplist',     $parameter_expplist);
	smarty_assign('parameter_exptable',     $parameter_exptable);
	smarty_assign('parameter_attr',     $parameter_attr);
	smarty_assign('parameter_other',     $parameter_other);
	smarty_assign('moduleparameter',     $moduleparameter);
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		$this->smarty_assign('parameter',     $parameter);
		$this->smarty_assign('parameter_list',     $parameter_list);
		$this->smarty_assign('parameter_json',     $parameter_json);
		$this->smarty_assign('parameter_default',     $parameter_default);
		$this->smarty_assign('parameter_exp',     $parameter_exp);
		$this->smarty_assign('parameter_expplist',     $parameter_expplist);
		$this->smarty_assign('parameter_exptable',     $parameter_exptable);
		$this->smarty_assign('parameter_attr',     $parameter_attr);
		$this->smarty_assign('parameter_other',     $parameter_other);
		$this->smarty_assign('moduleparameter',     $moduleparameter);
	}	
	
	// 获取模块参数扩展HTML
	$contentexphtml = getadmincontentexphtml($configinfo['moduleid']);
	
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		// 【模块参数后台程序模板安装】模块参数HTML配置
		$hook_detail_contenthtml = $this->configadminhook('configmodulepara','detail_contenthtml',array('contenthtml'=>$contenthtml));
		$this->smarty_assign('hook_detail_contenthtml', $hook_detail_contenthtml);
		$hook_module_contenthtml = $this->configadminhook($configinfo['modulename'],'module_contenthtml');
		$this->smarty_assign('hook_module_contenthtml', $hook_module_contenthtml);
		
		// 【模块参数后台程序模板安装】模块参数扩展HTML配置
		$hook_detail_contentexphtml = $this->configadminhook('configmodulepara','detail_contentexphtml',array('contentexphtml'=>$contentexphtml));
		$this->smarty_assign('hook_detail_contentexphtml', $hook_detail_contentexphtml);
		
		// 【模块参数后台程序模板安装】多语言配置
		$hook_list_listlang = $this->configadminhook('configmodulepara','list_listlang');
		$this->smarty_assign('hook_list_listlang', $hook_list_listlang);
	}	
	
	// 后台模板配置
	$parametersmartyadmin = getparametersmarty($configinfo['moduleid'], 'detail');
	// 开启前台模板配置后台模板【使用view_base改变模板全局加载地址必需放在最底部】
	if($configinfo['configadmintplok'] == 1)
	{
		$modulehook = "configadmintpl";require(MODULEPARA_PATH . 'config/modulehook.php');// 配置系统钩子
	}
}

if($setblock == 'edit')
{
	// 城市分站
	if($configinfo['cityok'] == 1)
	{
		$modulehook = "citytab";$hookblock = "admincityclass";require(MODULEPARA_PATH . 'config/modulehook.php');// 配置系统钩子
	}
	
	// 获取模块参数
	$dataparameter = getmoduleparameter($configinfo['get_admin_id'],$configinfo['moduleid'],array('listattrid'=>moduleaqvarval('listattrid','intval')));
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		$this->smarty_assign('dataparameter', $dataparameter);
	}else{
		smarty_assign('dataparameter', $dataparameter);
	}
	
	// 多语言栏目
	if($configinfo['columninfo'][$configinfo['cat_id']] == $configinfo['langcolumnid'])
	{
		require(MODULEPARA_PATH . '/modulepara-'.VERSION_NUMBER.'/modulepara/configdetail_langcolumn.php');
	}
	
	// 模块权限管理
	if($configinfo['adminok'] == 1 && $configinfo['columninfo'][$configinfo['cat_id']] == $configinfo['adminpricolumnid'])
	{
		require(MODULEPARA_PATH . '/modulepara-'.VERSION_NUMBER.'/modulepara/configdetail_adminpri.php');
	}
	
	// 模块关闭配置
	if($configinfo['modulecolseok'] == 1 && $configinfo['columninfo'][$configinfo['cat_id']] == $configinfo['adminmodulecolsecolumnid'])
	{
		require(MODULEPARA_PATH . '/modulepara-'.VERSION_NUMBER.'/modulepara/configdetail_modulecolse.php');
	}
	
	// 模块参数模板指定
	global $parameter;
	global $parameter_list;
	global $parameter_json;
	global $parameter_default;
	global $parameter_exp;
	global $parameter_expplist;
	global $parameter_exptable;
	global $parameter_attr;
	global $parameter_other;
	global $moduleparameter;
	
	// 获取模块参数HTML
	global $parameter_out,$getmoduleconfig;// 外部配置参数信息
	$contenthtml = configmoduleparameter($configinfo['get_admin_id']);

	// 默认字段开启关闭配置
	$articledeffield = getdefaultarticlefield($configinfo['moduleid']);
	$defaultfield = $articledeffield['defaultfield'];
	$otherinfoconfig = $articledeffield['otherinfoconfig'];
	$toptype = $configinfo['moduleinfo']['index_num'];
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		$this->smarty_assign('defaultfield',  $defaultfield);
		$this->smarty_assign('otherinfoconfig',  $otherinfoconfig);
		$this->smarty_assign('toptype',  $toptype);
	}else{
		smarty_assign('defaultfield',  $defaultfield);
		smarty_assign('otherinfoconfig',  $otherinfoconfig);
		smarty_assign('toptype',  $toptype);
	}

	// 模块参数模板指定
	smarty_assign('parameter',     $parameter);
	smarty_assign('parameter_list',     $parameter_list);
	smarty_assign('parameter_json',     $parameter_json);
	smarty_assign('parameter_default',     $parameter_default);
	smarty_assign('parameter_exp',     $parameter_exp);
	smarty_assign('parameter_expplist',     $parameter_expplist);
	smarty_assign('parameter_exptable',     $parameter_exptable);
	smarty_assign('parameter_attr',     $parameter_attr);
	smarty_assign('parameter_other',     $parameter_other);
	smarty_assign('moduleparameter',     $moduleparameter);
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{
		$this->smarty_assign('parameter',     $parameter);
		$this->smarty_assign('parameter_list',     $parameter_list);
		$this->smarty_assign('parameter_json',     $parameter_json);
		$this->smarty_assign('parameter_default',     $parameter_default);
		$this->smarty_assign('parameter_exp',     $parameter_exp);
		$this->smarty_assign('parameter_expplist',     $parameter_expplist);
		$this->smarty_assign('parameter_exptable',     $parameter_exptable);
		$this->smarty_assign('parameter_attr',     $parameter_attr);
		$this->smarty_assign('parameter_other',     $parameter_other);
		$this->smarty_assign('moduleparameter',     $moduleparameter);
	}
	
	// 获取模块参数扩展HTML
	$contentexphtml = getadmincontentexphtml($configinfo['moduleid']);
	
	// 开启MVC框架模式
	if($configinfo['mvc'] == 1)
	{		
		// 【模块参数后台程序模板安装】模块参数HTML配置
		$hook_detail_contenthtml = $this->configadminhook('configmodulepara','detail_contenthtml',array('contenthtml'=>$contenthtml));
		$this->smarty_assign('hook_detail_contenthtml', $hook_detail_contenthtml);
		$hook_module_contenthtml = $this->configadminhook($configinfo['modulename'],'module_contenthtml');
		$this->smarty_assign('hook_module_contenthtml', $hook_module_contenthtml);
		
		// 【模块参数后台程序模板安装】模块参数扩展HTML配置
		$hook_detail_contentexphtml = $this->configadminhook('configmodulepara','detail_contentexphtml',array('contentexphtml'=>$contentexphtml));
		$this->smarty_assign('hook_detail_contentexphtml', $hook_detail_contentexphtml);
		
		// 【模块参数后台程序模板安装】多语言配置
		$hook_list_listlang = $this->configadminhook('configmodulepara','list_listlang');
		$this->smarty_assign('hook_list_listlang', $hook_list_listlang);
	}
	
	// 后台模板配置
	$parametersmartyadmin = getparametersmarty($configinfo['moduleid'], 'detail');
	// 开启前台模板配置后台模板【使用view_base改变模板全局加载地址必需放在最底部】
	if($configinfo['configadmintplok'] == 1)
	{
		$modulehook = "configadmintpl";require(MODULEPARA_PATH . 'config/modulehook.php');// 配置系统钩子
	}
}

if($setblock == 'insert')
{
	// 插入数据前
	$configmodulehook = "article";$hookname = "detail_insert_before";require(MODULEPARA_PATH . '/config/load/configmodulehook.php');
	
	// 下一个语言URL
	$downlangurl = getdownlangurl($configinfo['downlangurl'],$configinfo['defaultlangurl']);
	
	// 插入模块参数
	$resdata = insertmoduleparameter($configdataid);
	
	// 错误提示
	if($resdata['error'] > 0)
	{
		$modulehook = "errortip";$tipcontent = $resdata['message'];require(MODULEPARA_PATH . 'config/modulehook.php');
	}
	
	// 插入数据后
	$configmodulehook = "article";$hookname = "detail_insert_rear";require(MODULEPARA_PATH . '/config/load/configmodulehook.php');
}

if($setblock == 'update')
{
	// 修改数据前
	$configmodulehook = "article";$hookname = "detail_update_before";require(MODULEPARA_PATH . '/config/load/configmodulehook.php');
	
	// 多语言管理
	if($configinfo['langdataok'] == 1 && $configinfo['columninfo'][$configinfo['cat_id']] == $configinfo['langdatacolumnid'])
	{
		require(MODULEPARA_PATH . '/modulepara-'.VERSION_NUMBER.'/modulepara/configdetail_langlist.php');
	}
	
	// 修改模块参数
	$resdata = updatemoduleparameter($configdataid);
	
	// 错误提示
	if($resdata['error'] > 0)
	{
		$modulehook = "errortip";$tipcontent = $resdata['message'];require(MODULEPARA_PATH . 'config/modulehook.php');
	}
}	
?>